// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '竞价数据管理平台' },
    redirect: '/dashboard/workplace',
    children: [
      // dashboard
      {
        path: '/dashboard',
        name: 'dashboard',
        redirect: '/dashboard/workplace',
        component: RouteView,
        meta: { title: '工作总览' },
        children: [
          {
            path: '/dashboard/workplace',
            name: 'Workplace',
            component: () => import('@/views/dashboard/Workplace'),
            meta: { title: '领取概况' }
          },
          {
            path: '/dashboard/state',
            name: 'State',
            component: () => import('@/views/dashboard/State'),
            meta: { title: '数据统计' }
          }
        ]
      },
      {
        path: '/customer',
        name: 'customer',
        redirect: '/customer/all',
        component: RouteView,
        meta: { title: '资源管理' },
        children: [
          {
            path: '/customer/list',
            name: 'CustomerList',
            component: () => import('@/views/customer/CustomerList'),
            meta: { title: '资源列表' }
          },
          {
            path: '/customer/recycle',
            name: 'Recycle',
            component: () => import('@/views/customer/Recycle'),
            meta: { title: '资源回收站' }
          },
          {
            path: '/customer/import-vip',
            name: 'ImportVip',
            component: () => import('@/views/customer/ImportVip'),
            meta: { title: '导入大客户' }
          }
        ]
      },
      {
        path: '/calls',
        name: 'calls',
        redirect: '/calls/all',
        component: RouteView,
        meta: { title: '通话管理' },
        children: [
          {
            path: '/calls/all',
            name: 'AllCalls',
            component: () => import('@/views/calls/AllCalls'),
            meta: { title: '所有通话' }
          }
        ]
      },
      {
        path: '/other',
        name: 'other',
        redirect: '/other',
        component: RouteView,
        meta: { title: '其他管理' },
        children: [
          {
            path: '/other/ip',
            name: 'IpConfig',
            component: () => import('@/views/other/IpConfig'),
            meta: { title: 'IP黑名单' }
          },
          {
            path: '/other/change',
            name: 'ChangePassword',
            component: () => import('@/views/other/ChangePassword'),
            meta: { title: '修改密码' }
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: BlankLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'sign',
        name: 'sign',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Sign')
      }
    ]
  },
  {
    path: '/pool/list',
    name: 'PoolList',
    component: () => import('@/views/customer/PoolList2'),
    meta: { title: '资源公共池' }
  },
  {
    path: '/pool/list2',
    name: 'ScreenPool',
    component: () => import('@/views/customer/ScreenPool'),
    meta: { title: '屏蔽号码池' }
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/404')
  }
]
